<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags" %> 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>添加图片信息</title>
    <link rel="stylesheet" href="<%=path%>/css/layui.css">

</head>
<body>	

<form class="layui-form" action="<%= basePath%>/StudentAction_add.action" method="post" enctype="multipart/form-data">

	<div class="layui-form-item">
        <label class="layui-form-label">上传图片</label>
        <div class="layui-input-block">
        	<input type = "file" lay-verify="required" autocomplete="off"  name = "file"  Id="file" onchange="verificationPicFile(this)">
        </div>
    </div>
    
    <!-- <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">图片类型</label>
        <div class="layui-input-block">
            <input type="text" name="imageType" lay-verify="required"  placeholder="请输入图片类型" autocomplete="off" class="layui-input" />
        </div>
    </div>
     -->
    <input type="hidden" name="saveAddress"   value="<%=basePath%>" />
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script src="../../js/jquery.js" type="text/javascript"></script>
<script src="../../js/layui.all.js" type="text/javascript"></script>
<script src="../../js/alert.js" type="text/javascript"></script>
<script type="text/javascript">
	
//图片大小验证
function verificationPicFile(file) {
    var fileSize = 0;
    var fileMaxSize = 1024/10;//100kb
    var filePath = file.value;
    if(filePath){
        fileSize =file.files[0].size;
        var size = fileSize / 1024;
        if (size > fileMaxSize) {
            Alert("文件大小不能大于100kb！");
            file.value = "";
            return false;
        }else if (size <= 0) {
            Alert("文件大小不能为0M！");
            file.value = "";
            return false;
        }
    }else{
        return false;
    }
}
	
    //Demo
    layui.use('laydate', function(){
        
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){

        });
        form.render();
    });
</script>

<%-- <script type="text/javascript">

layui.use([ 'form' ], function() {

	var form = layui.form, layer = layui.layer;
	form.on('submit(formDemo)', function(data) {
		var file=$("#file").val();
		alert(file);
		var imageClass=$("#imageClass").val();
		//var saveAddress=$("#saveAddress").val();
		$.ajax({
			type:'POST',
			url:'<%= basePath%>/biz/ImageInfo_add.action',
			data:{file:file,imageClass:imageClass},
			success:function(data){
				if(data=="1"){
				alert(data)
					window.parent.layer.closeAll();//关闭弹窗,saveAddress:saveAddress
				}
				else{
					layer.alert("添加信息错误",
					{title:'添加失败'});
				}
			}
		});
		return false;
	});
 
});

</script> --%>

</body>
</tml>